package com.ethan.aspectj;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;

public
/**
 * @Description:
 * @Author ethan
 * @CreateDate: 2021/12/6 10:38
 * @UpdateDate: 2021/12/6 10:38
 * @Version 1.0
 */
@Aspect
class LogAspact {

    @Pointcut("execution(@com.ethan.aspectj.Log * *(..))")
    public void aspectAnalyzeAnnotation() {

    }
    @Around("aspectAnalyzeAnnotation()")
    public void aroundJoinAspectAnalyze(final ProceedingJoinPoint joinPoint) throws Throwable {
        Object target = joinPoint.getTarget();
        MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
        Log aspectAnalyze = methodSignature.getMethod().getAnnotation(Log.class);
        long startTimeMillis = System.currentTimeMillis();
        System.out.println("你好："+target.getClass().getSimpleName()+aspectAnalyze.name());
        joinPoint.proceed();

    }


}
